package com.rz.htk.order.task;

import com.rz.htk.order.entity.Order;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Component
@Scope("prototype")
public class OrderThread implements Runnable{

    private Logger logger = LoggerFactory.getLogger("OrderThread");

    @Resource
    private OrderTask orderTask;
    private Order order;

    public void setOrder(Order order) {
        this.order = order;
    }

    @Override
    public void run() {
        try{
            logger.info(Thread.currentThread().getName()+"处理轨迹线程开始");
            List<Order> orders = new ArrayList<>();
            orders.add(order);
            orderTask.pushOrderToDaRong(orders);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
